package com.ling.pl.security.view.global;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.data.provider.Criteria;
import com.bstek.dorado.data.provider.Page;
import com.ling.core.common.utils.D7PageUtils;
import com.ling.pl.core.commons.support.DaoPage;
import com.ling.pl.security.feign.DefaultGroupService;
import com.ling.pl.security.model.DefaultGroupVO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author bo.wang
 * @since 2013-2-17
 */
@Component("ling2.groupSelect")
public class GroupSelect {
    @Resource
    DefaultGroupService groupService;

    @DataProvider
    public void loadGroups(Page<DefaultGroupVO> page, Criteria criteria) throws Exception {
        DaoPage daoPage = groupService.findDefaultGroupByPage(D7PageUtils.buildQueryParams(criteria, page));
        D7PageUtils.daoPageToPage(daoPage, page);
    }
}
